package bb.lanxing.mvvm.sportsetting

import bb.lanxing.net.retrofit.GenericResponse
import bb.lanxing.net.retrofit.XossRetrofitApiClient

class SportSettingRepository private constructor() {
    private val mService by lazy {
        XossRetrofitApiClient.getInstance().create(SportSettingService::class.java)
    }

    suspend fun getSportSetting(userId: Long): GenericResponse<UserSportSetting?> {
        return mService.getSportSetting()
    }

    suspend fun updateSportSetting(
        userId: Long, userSportSetting: UserSportSetting
    ): GenericResponse<UserSportSetting> {
        return mService.updateSportSetting(userSportSetting)
    }


    companion object {
        @Volatile
        private var instance: SportSettingRepository? = null
        fun getInstance() = instance ?: synchronized(this) {
            instance ?: SportSettingRepository()
        }
    }
}